package com.FCS.APP.fcsgroup

import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.util.Log
import com.yade.video.imsdk.base.IMManager
import com.yade.video.imsdk.base.LoginListener
import io.agora.rtm.ErrorInfo
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity() {
    private var mUserId = "13800138000"
    private var mTargetName = "123"
    private var mAPPid = "604219210001"
    private var mSign = "21eff97359dd3f1dde7459ee18a4689a"
    private var mTs = "1612248944674"
    private var mIsShowVideo = true
    private var mIsShowPic = true
    private var mIsShowFile = true
    private var mIsShowLocation = true
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        rbShowPic.setOnCheckedChangeListener { compoundButton, b ->
            if (b) {
                mIsShowPic = true
            }
        }
        rbNoShowPic.setOnCheckedChangeListener { compoundButton, b ->
            if (b) {
                mIsShowPic = false
            }
        }
        rbShowVideo.setOnCheckedChangeListener { compoundButton, b ->
            if (b) {
                mIsShowVideo = true
            }
        }
        rbNoShowVideo.setOnCheckedChangeListener { compoundButton, b ->
            if (b) {
                mIsShowVideo = false
            }
        }
        rbShowFile.setOnCheckedChangeListener { compoundButton, b ->
            if (b) {
                mIsShowFile = true
            }
        }
        rbNoShowFile.setOnCheckedChangeListener { compoundButton, b ->
            if (b) {
                mIsShowFile = false
            }
        }
        rbShowLocation.setOnCheckedChangeListener { compoundButton, b ->
            if (b) {
                mIsShowLocation = true
            }
        }
        rbNoShowLocation.setOnCheckedChangeListener { compoundButton, b ->
            if (b) {
                mIsShowLocation = false
            }
        }
        txtChat.setOnClickListener {
            IMManager.getInstance().startChatActivity(this, mTargetName, mUserId, "视频服务", mIsShowPic, mIsShowVideo, mIsShowFile, mIsShowLocation)
        }
//        AllConfigValue.targetName = mTargetName
        IMManager.getInstance().login(mAPPid, mUserId, mSign, mTs, object : LoginListener{
            override fun loginFailure(errorInfo: ErrorInfo) {
                Log.e("chen","----errorInfo-----" + errorInfo)
            }

            override fun loginSuccess() {
                Log.e("chen","----loginSuccess-----")
            }

        })
//        AllConfigValue.mapKey = "N3PBZ-F2QH4-PC6UK-DPGHX-I6BZ6-4MFWD"
    }

}
